<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>spaceship.AutoShield</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="spaceship-module.html">Module&nbsp;spaceship</a> ::
        Class&nbsp;AutoShield
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="spaceship.AutoShield-class.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== CLASS DESCRIPTION ==================== -->
<h1 class="epydoc">Class AutoShield</h1><span class="codelink"><a href="spaceship-pysrc.html#AutoShield">source&nbsp;code</a></span><br /><br />
<pre class="base-tree">
       <a href="base.AGObject-class.html">base.AGObject</a> --+        
                       |        
          object --+   |        
                   |   |        
pygame.sprite.Sprite --+        
                       |        
                <a href="spaceship.AGSprite-class.html">AGSprite</a> --+    
                           |    
                      <a href="spaceship.Shield-class.html">Shield</a> --+
                               |
                              <strong class="uidshort">AutoShield</strong>
</pre>

<dl><dt>Known Subclasses:</dt>
<dd>
    <a href="spaceship.BasicAutoShield-class.html">BasicAutoShield</a>,
    <a href="spaceship.EnemyShipShield-class.html">EnemyShipShield</a>,
    <a href="spaceship.SuperShield-class.html">SuperShield</a>
</dd></dl>

<hr />
Base class for all automatically activated shields. AutoShield is 
  activated automatically when projectile moving with speed lesser than 
  <code>critical_speed</code> approaches owner so that it could hit it in 
  next iteration. Automatically activated shield is also automatically 
  deactivated. If player activates shield manually it cannot be 
  automatically deactivated unless there is no more energy.<br /><br />

<!-- ==================== INSTANCE METHODS ==================== -->
<a name="section-InstanceMethods"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Instance Methods</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-InstanceMethods"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="spaceship.AutoShield-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">owner</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="spaceship-pysrc.html#AutoShield.__init__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="spaceship.AutoShield-class.html#activate" class="summary-sig-name">activate</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">on</span>,
        <span class="summary-sig-arg">auto</span>=<span class="summary-sig-default">False</span>)</span><br />
      Activate or deactivate the shield.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="spaceship-pysrc.html#AutoShield.activate">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="spaceship.AutoShield-class.html#absorb" class="summary-sig-name">absorb</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">damage</span>,
        <span class="summary-sig-arg">efficiency</span>=<span class="summary-sig-default">1.0</span>,
        <span class="summary-sig-arg">speed</span>=<span class="summary-sig-default">None</span>)</span><br />
      If shield is not active and <code>speed</code> is not higher than 
      <code>self.critical_speed</code> activate it and absorb damage.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="spaceship-pysrc.html#AutoShield.absorb">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="spaceship.AutoShield-class.html#update" class="summary-sig-name">update</a>(<span class="summary-sig-arg">self</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="spaceship-pysrc.html#AutoShield.update">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
  <tr>
    <td colspan="2" class="summary">
    <p class="indent-wrapped-lines"><b>Inherited from <code><a href="spaceship.Shield-class.html">Shield</a></code></b>:
      <code><a href="spaceship.Shield-class.html#get_demand">get_demand</a></code>,
      <code><a href="spaceship.Shield-class.html#recharge">recharge</a></code>
      </p>
    <p class="indent-wrapped-lines"><b>Inherited from <code><a href="spaceship.AGSprite-class.html">AGSprite</a></code></b>:
      <code><a href="spaceship.AGSprite-class.html#closest">closest</a></code>,
      <code><a href="spaceship.AGSprite-class.html#distance">distance</a></code>,
      <code><a href="spaceship.AGSprite-class.html#is_offscreen">is_offscreen</a></code>,
      <code><a href="spaceship.AGSprite-class.html#kill">kill</a></code>,
      <code><a href="spaceship.AGSprite-class.html#set_mover">set_mover</a></code>
      </p>
    <div class="private">    <p class="indent-wrapped-lines"><b>Inherited from <code><a href="spaceship.AGSprite-class.html">AGSprite</a></code></b> (private):
      <code><a href="spaceship.AGSprite-class.html#_blit_state">_blit_state</a></code>,
      <code><a href="spaceship.AGSprite-class.html#_check_cfg">_check_cfg</a></code>,
      <code><a href="spaceship.AGSprite-class.html#_check_gfx">_check_gfx</a></code>,
      <code><a href="spaceship.AGSprite-class.html#_init_animation">_init_animation</a></code>,
      <code><a href="spaceship.AGSprite-class.html#_initialize_position">_initialize_position</a></code>,
      <code><a href="spaceship.AGSprite-class.html#_state_area">_state_area</a></code>,
      <code><a href="spaceship.AGSprite-class.html#_update_animations">_update_animations</a></code>,
      <code><a href="spaceship.AGSprite-class.html#_update_position">_update_position</a></code>
      </p></div>
    <div class="private">    <p class="indent-wrapped-lines"><b>Inherited from <code><a href="base.AGObject-class.html">base.AGObject</a></code></b> (private):
      <code><a href="base.AGObject-class.html#_setattrs">_setattrs</a></code>
      </p></div>
    <p class="indent-wrapped-lines"><b>Inherited from <code>pygame.sprite.Sprite</code></b>:
      <code>__repr__</code>,
      <code>add</code>,
      <code>add_internal</code>,
      <code>alive</code>,
      <code>groups</code>,
      <code>remove</code>,
      <code>remove_internal</code>
      </p>
    <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
      <code>__delattr__</code>,
      <code>__getattribute__</code>,
      <code>__hash__</code>,
      <code>__new__</code>,
      <code>__reduce__</code>,
      <code>__reduce_ex__</code>,
      <code>__setattr__</code>,
      <code>__str__</code>
      </p>
    </td>
  </tr>
</table>
<!-- ==================== STATIC METHODS ==================== -->
<a name="section-StaticMethods"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Static Methods</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-StaticMethods"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
  <tr>
    <td colspan="2" class="summary">
    <div class="private">    <p class="indent-wrapped-lines"><b>Inherited from <code><a href="spaceship.AGSprite-class.html">AGSprite</a></code></b> (private):
      <code><a href="spaceship.AGSprite-class.html#_closest_compare_dists">_closest_compare_dists</a></code>
      </p></div>
    </td>
  </tr>
</table>
<!-- ==================== CLASS VARIABLES ==================== -->
<a name="section-ClassVariables"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Class Variables</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-ClassVariables"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="vanish_speed"></a><span class="summary-name">vanish_speed</span> = <code title="1">1</code>
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="vanish_time"></a><span class="summary-name">vanish_time</span> = <code title="0">0</code>
    </td>
  </tr>
</table>
<!-- ==================== INSTANCE VARIABLES ==================== -->
<a name="section-InstanceVariables"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Instance Variables</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-InstanceVariables"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">float</span>
    </td><td class="summary">
        <a name="critical_speed"></a><span class="summary-name">critical_speed</span> = <code title="0">0</code><br />
      Maximal speed of objects that will automatically trigger shield 
      expressed in pixels per second.
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">bool</span>
    </td><td class="summary">
        <a name="auto"></a><span class="summary-name">auto</span> = <code title="True">True</code><br />
      Tells whether shield was activated automatically or not.
    </td>
  </tr>
  <tr>
    <td colspan="2" class="summary">
    <p class="indent-wrapped-lines"><b>Inherited from <code><a href="spaceship.Shield-class.html">Shield</a></code></b>:
      <code><a href="spaceship.Shield-class.html#active">active</a></code>,
      <code><a href="spaceship.Shield-class.html#cost">cost</a></code>,
      <code><a href="spaceship.Shield-class.html#current">current</a></code>,
      <code><a href="spaceship.Shield-class.html#maximum">maximum</a></code>,
      <code><a href="spaceship.Shield-class.html#owner">owner</a></code>,
      <code><a href="spaceship.Shield-class.html#recharge_rate">recharge_rate</a></code>
      </p>
    <p class="indent-wrapped-lines"><b>Inherited from <code><a href="spaceship.AGSprite-class.html">AGSprite</a></code></b>:
      <code><a href="spaceship.AGSprite-class.html#align">align</a></code>,
      <code><a href="spaceship.AGSprite-class.html#center">center</a></code>,
      <code><a href="spaceship.AGSprite-class.html#cfg">cfg</a></code>,
      <code><a href="spaceship.AGSprite-class.html#gfx">gfx</a></code>,
      <code><a href="spaceship.AGSprite-class.html#max_speed">max_speed</a></code>,
      <code><a href="spaceship.AGSprite-class.html#mover">mover</a></code>,
      <code><a href="spaceship.AGSprite-class.html#offscreen_lifetime">offscreen_lifetime</a></code>,
      <code><a href="spaceship.AGSprite-class.html#offscreen_time">offscreen_time</a></code>,
      <code><a href="spaceship.AGSprite-class.html#pos">pos</a></code>,
      <code><a href="spaceship.AGSprite-class.html#screen_size">screen_size</a></code>
      </p>
    <div class="private">    <p class="indent-wrapped-lines"><b>Inherited from <code><a href="spaceship.AGSprite-class.html">AGSprite</a></code></b> (private):
      <code><a href="spaceship.AGSprite-class.html#_animations">_animations</a></code>,
      <code><a href="spaceship.AGSprite-class.html#_overlay">_overlay</a></code>
      </p></div>
    <p class="indent-wrapped-lines"><b>Inherited from <code><a href="base.AGObject-class.html">base.AGObject</a></code></b>:
      <code><a href="base.AGObject-class.html#clock">clock</a></code>
      </p>
    </td>
  </tr>
</table>
<!-- ==================== PROPERTIES ==================== -->
<a name="section-Properties"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Properties</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Properties"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
  <tr>
    <td colspan="2" class="summary">
    <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
      <code>__class__</code>
      </p>
    </td>
  </tr>
</table>
<!-- ==================== METHOD DETAILS ==================== -->
<a name="section-MethodDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Method Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-MethodDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="__init__"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">owner</span>)</span>
    <br /><em class="fname">(Constructor)</em>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="spaceship-pysrc.html#AutoShield.__init__">source&nbsp;code</a></span>&nbsp;
    </td>
  </table>
  
  
  <dl class="fields">
    <dt>Overrides:
      <a href="spaceship.Shield-class.html#__init__">Shield.__init__</a>
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="activate"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">activate</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">on</span>,
        <span class="sig-arg">auto</span>=<span class="sig-default">False</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="spaceship-pysrc.html#AutoShield.activate">source&nbsp;code</a></span>&nbsp;
    </td>
  </table>
  
  Activate or deactivate the shield. Display shield graphics if shield 
  is activated. Do not allow the shield to be automatically deactivated id 
  it was activated by player.
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>on</code></strong> (bool) - Tells whether shield should be activated or deactivated.</li>
        <li><strong class="pname"><code>auto</code></strong> (bool) - Tells whether action is taken by player or automatically.</li>
    </ul></dd>
    <dt>Overrides:
      <a href="spaceship.Shield-class.html#activate">Shield.activate</a>
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="absorb"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">absorb</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">damage</span>,
        <span class="sig-arg">efficiency</span>=<span class="sig-default">1.0</span>,
        <span class="sig-arg">speed</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="spaceship-pysrc.html#AutoShield.absorb">source&nbsp;code</a></span>&nbsp;
    </td>
  </table>
  
  If shield is not active and <code>speed</code> is not higher than 
  <code>self.critical_speed</code> activate it and absorb damage. Return 
  remaining raw damage.
  <dl class="fields">
    <dt>Overrides:
      <a href="spaceship.Shield-class.html#absorb">Shield.absorb</a>
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="update"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">update</span>(<span class="sig-arg">self</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="spaceship-pysrc.html#AutoShield.update">source&nbsp;code</a></span>&nbsp;
    </td>
  </table>
  
  
  <dl class="fields">
    <dt>Overrides:
      <a href="spaceship.Shield-class.html#update">Shield.update</a>
    </dt>
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0beta1 on Thu Jul 31 17:03:02 2008
    </td>
    <td align="right" class="footer">
      <a href="http://epydoc.sourceforge.net">http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie()
  // -->
</script>
  
</body>
</html>
